/**
 * @CreateBy: zhaojun
 * @CreateTime: 2018-08-04
 * @Desc: 用户管理Controller
 */
package com.atwork.controller;

import com.atwork.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping(value = "/user")
public class SysUserController {

    @Autowired
    private SysUserService sysUserService;

    /**
     * 分页获取全部User
     * @param pageNum
     * @param pageSize
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/getAll/{pageNum}/{pageSize}",
            produces = {"application/json;charset=UTF-8"})
    public Object getAllUser(@PathVariable("pageNum") int pageNum,
                             @PathVariable("pageSize")int pageSize){
        return sysUserService.getAllUser(pageNum,pageSize);
    }

    /**
     * 通过用户名获取用户
     */
    @ResponseBody
    @RequestMapping(value = "/getUserByLoginName")
    public Object getUserByLoginName(String loginName){
        return sysUserService.getUserByLoginName(loginName);
    }
}
